//
//  NewTongDaoViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/26.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewTongDaoViewController.h"
#import "JTCSM.h"
#import "NewTongDaoTableViewCell.h"
#import "NewKuaiJiePayViewController.h"
@interface NewTongDaoViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableview;
@end

@implementation NewTongDaoViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [df isRemoveTarbar:YES];
    self.navigationController.navigationBar.hidden = NO;
    self.view.backgroundColor =[UIColor whiteColor];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    [self layoutTableView];
}

- (void)layoutTableView{
    
    _tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KCONTROLLERWith, KCONTROLLERHeight) style:UITableViewStylePlain];
    _tableview.delegate = self;
    _tableview.dataSource = self;
    [self.view addSubview:_tableview];
    _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10+1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 10) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"footerview"];
        if (cell == nil) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"footerview"];
            UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KCONTROLLERWith, 83)];
            backview.backgroundColor = RGBACOLOR(241, 241, 241, 1);
            backview.userInteractionEnabled = YES;
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = CGRectMake(40, 33, KCONTROLLERWith-80, 50);
            button.backgroundColor = KZhuTiRGB;
            [button setTitle:@"确认" forState:UIControlStateNormal];
            [button setTintColor:[df colorWithHexString:@"333333" alpha:1]];
            button.titleLabel.font = [UIFont systemFontOfSize:18];
            [backview addSubview:button];
            [df layerWithView:button radius:25 width:0 color:nil];
            [cell.contentView addSubview:backview];
            [button addTarget:self action:@selector(sure) forControlEvents:UIControlEventTouchUpInside];
            cell.backgroundColor = RGBACOLOR(241, 241, 241, 1);
            
        }
        return cell;
    }else{
        NSString *cellid = [NSString stringWithFormat:@"textfield%ld",(long)indexPath.row];
        NewTongDaoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];
        if (cell == nil) {
            cell = [[NewTongDaoTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid];
        }
        [cell setValueWithModel:indexPath];
        return cell;
    }
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 10) {
        return 103;
    }else{
       return 120;
    }
   
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
}

- (void)sure{
    NewKuaiJiePayViewController *vc = [[NewKuaiJiePayViewController alloc]init];
    vc.nameTitle = @"快捷支付";
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
